import * as echarts from 'echarts'

/**
 * 基础折线图
 * @param el
 * @param params
 * @author 赵京涛
 */
export const useLineEchartsHandler = (el, params) => {
  const myChart = echarts.init(el)
  const option = {
    xAxis: {
      type: 'category',
      data: params.xData
    },
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        type: 'cross'
      }
    },
    yAxis: {
      type: 'value'
    },
    series: [
      {
        data: params.seriesData,
        type: 'line',
        smooth: true
      }
    ]
  }
  option && myChart.setOption(option)
}
